{extend name="../../common/view/main"/}
{block name="style"}
<link href="__STATIC__/ucenter/css/main.min.css" rel="stylesheet">
{/block}
{block name="body"}

<!--用户设置顶部-->
<!-- {include file="config/_header"/} -->
<!--用户设置顶部end-->

<div id="main-container" class="user-config">
    <div class="container-fixed clearfix">
        <div class="left-slide">
            {include file="common/_slide"/}
        </div>
        <div class="right-content">
            <div id="usercenter-content-td ">
                <div class="config-content change-password">
                    <h2>密码修改</h2>
                    
                    <form id="changePasswordForm"  action="{:Url('ucenter/Config/password')}" method="post" class="ajax-form form-horizontal">
                        <div class="form-group">
                            <label for="inputOldPassword" class="col-xs-2 control-label">旧密码</label>
        
                            <div class="col-xs-10">
                                <input type="password" class="form-control" id="inputOldPassword" value="" name="old_password" placeholder="旧密码">
                            </div>
                        </div>
        
                        <div class="form-group">
                            <label for="inputNewPassword" class="col-xs-2 control-label">新密码</label>
        
                            <div class="col-xs-10">
                                <input type="password" class="form-control" id="inputNewPassword" value="" name="new_password" placeholder="新密码">
                            </div>
                        </div>
        
                        <div class="form-group">
                            <label for="inputConfirmPassword" class="col-xs-2 control-label">确认新密码</label>
        
                            <div class="col-xs-10">
                                <input type="password" class="form-control" id="inputConfirmPassword" value="" name="confirm_password" placeholder="确认密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-xs-10">
                                <p class="text-danger" id="submitTip"></p>
                                <button type="submit" class="btn btn-primary">保存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
</div>

{/block}

{block name="script"}
<script src="__STATIC__/ucenter/js/main.min.js"></script>
<script>
    $(function () {
        $(window).resize(function () {
            $("#main-container").css("min-height", $(window).height() - 343);
        }).resize();

        // 设置当前高亮菜单
        $("#{$tab}").addClass('active');
    })

    $(function () {
        var $sidebar = $('#usercenter-sidebar-td');
        var $sidebar_xs = $('#usercenter-sidebar-xs');
        var $sidebar_sm = $('#usercenter-sidebar-sm');
        var $content = $('#usercenter-content-td');

        function trigger_resp() {
            var width = $(window).width();
            if (width < 768) {
                on_xs();
            } else {
                on_sm();
            }
        }

        function on_xs() {
            $sidebar_xs.append($sidebar);
            $content.css({'padding-left': 0, 'padding-right': 0});
        }

        function on_sm() {
            $sidebar_sm.prepend($sidebar);
        }

        trigger_resp();

        $(window).resize(function () {
            trigger_resp();
        })
    })


    function center_toggle(name) {
        var show = $('#' + name + '_panel').css('display');
        $('.center_panel').hide();
        $('.center_arrow_right').show();
        $('.center_arrow_bottom').hide()
        if (show == 'none') {
            $('#' + name + '_panel').show();
            $('#' + name + '_toggle_right').hide();
            $('#' + name + '_toggle_bottom').show()
        } else {
            $('#' + name + '_toggle_right').show();
            $('#' + name + '_toggle_bottom').hide()
        }
    }

    $(function () {
        $('.saveUsername').click(function () {
            var username = $(this).prev().val();
            if (!username) {
                toast.error("{:lang('_USERNAME_NOT_EMPTY_')}{:lang('_EXCLAMATION_')}");
                return false;
            }
            if (confirm("{:lang('_USERNAME_SET_ONCE_')}{:lang('_QUESTION_')}")) {
                $.post("{:url('ucenter/config/saveUsername')}", {username: username}, function (res) {
                    handleAjax(res);
                })
            }
        })
    })
</script>
{/block}